#include<iostream>
#include<map>
using namespace std;

enum CHECKRETURN{
	CHECK_INVALID = -2,
	CHECK_SMALL = -1,
	CHECK_EQUAL = 0;
	CHECK_LARGE = 1;
};

class Symbol_priority{

int islarge(char s1,char s2);
public:
static map<char,const int> symbol;
static const int primap[7][7];
};

map<char,const int> Symbol_priority::symbol={
	{'+',0},
	{'-',1},
	{'*',2},
	{'/',3},
	{'(',4},
	{')',5},
	{'#',6}
};

/**
 * 优先级表格
 * */
const int Symbol_priority::primap[7][7] = {
	{CHECK_LARGE, 	    CHECK_LARGE,		CHECK_SMALL,		CHECK_SMALL,		CHECK_SMALL,		CHECK_LARGE,		CHECK_LARGE},
	{CHECK_LARGE,		CHECK_LARGE,		CHECK_SMALL,		CHECK_SMALL,		CHECK_SMALL,		CHECK_LARGE,		CHECK_LARGE},
	{CHECK_LARGE,		CHECK_LARGE,		CHECK_LARGE,		CHECK_LARGE,		CHECK_SMALL,		CHECK_LARGE,		CHECK_LARGE},
	{CHECK_LARGE,		CHECK_LARGE,		CHECK_LARGE,		CHECK_LARGE,		CHECK_SMALL,		CHECK_LARGE,		CHECK_LARGE},
	{CHECK_SMALL,		CHECK_SMALL,		CHECK_SMALL,		CHECK_SMALL,		CHECK_SMALL,		CHECK_EQUAL,		CHECK_SMALL},
	{CHECK_LARGE,		CHECK_LARGE,		CHECK_LARGE,		CHECK_LARGE,		CHECK_INVALID,	    CHECK_LARGE,		CHECK_INVALID},
	{CHECK_SMALL,		CHECK_SMALL,		CHECK_SMALL,		CHECK_SMALL,		CHECK_SMALL,		CHECK_INVALID,	    CHECK_EQUAL}
};

/**
 * 检测输入的操作字符是否有效  
 */
static const char *valid_char = "+-*/()#";
static bool check_valid(char s1, char s2){
	if(strchr(valid_char, s1) && strchr(valid_char, s2)){
		return true;
	}
	return false;
}

int Symbol_priority::islarge(char s1,char s2){
	if(check_valid(s1,s2) != true){
		return CHECK_INVALID;
	}
	return primap[ symbol[s1] ][ symbol[s2] ];
}



int main(int argc,char* argv[]){
	std::cout << "hello world" << std::endl;
	std::cout << Symbol_priority::symbol['*'] << std::endl;
	return 0;
}
